using System;
using System.Collections.Generic;
using System.Text;
using WozLib.UI.Ink;

namespace WozLib.WozObjects
{
  public class ReplacementPadServerObject : ScreenServerObject
  {
    public ReplacementPadServerObject()
    {
    }

    public ReplacementPadServerObject(long serverID)
      : base(serverID)
    {
    }

    public override IServerObject GetIServerObject()
    {
      // we'll first try to let our base pull it out of the registry or create one 
      //IServerObject iServerObject = base.GetIServerObject();
      
      // $tss trying to fix loading
      //IServerObject iServerObject = null;

      // if our base didn't couldn't find the IServerObject
      // or if it's of the wrong type, we'll try to make our own

      //if (iServerObject == null || !(iServerObject is ReplacementPad))
      //{
      //  iServerObject = ReplacementPad.FromReplacementPadServerObject(this);


      //  ServerObjectRegistry.RegisterObjectWithExisitingId(iServerObject);

      //  // !!! the code below is wrong - it will cause the newly created iServerObject not to
      //  // actually be created - replaced with above code
      //  // don't know where else this is broken

        
      //  // if we do not the IWozObject we just created is not registered, register it
      //  //if (iServerObject != null && !ServerObjectRegistry.ContainsObject(iServerObject.ServerID))
      //  //{
      //  //  ServerObjectRegistry.RegisterObjectWithExisitingId(iServerObject);
      //  //}

        
      //}

      ReplacementPad replacementPad = ReplacementPad.FromReplacementPadServerObject(this);


      ServerObjectRegistry.RegisterObjectWithExisitingId(replacementPad);

      return replacementPad;
    }
  }
}
